
export const timeCorrect = (wrongTime)=>{
    {
        const utcDate = new Date(wrongTime);
        const options = {
            timeZone: 'Asia/Shanghai',
            year: 'numeric',
            month: '2-digit',
            day: '2-digit',
            hour: '2-digit',
            minute: '2-digit',
        };
        const formattedDate = new Intl.DateTimeFormat('zh-CN', options)
            .formatToParts(utcDate)
            .map(({ type, value }) => (type === 'literal' && value === '-' ? ' ' : value))
            .join('');
        return formattedDate;
    }
}

/*
export const timeBackFormat = (dateString)=>{
    // 解析日期字符串
    const date = new Date(dateString.replace(/-/g, '/'));

    // 获取 UNIX 时间戳（单位：毫秒）
    const timestamp = date.getTime();

    // 如果后端需要秒为单位的时间戳，除以 1000
    // const timestampInSeconds = Math.floor(timestamp / 1000);

    return timestamp;
}*/
